package main;

import java.util.LinkedList;

import parser.EntityElement;
import parser.EntityWriter;
import analyzer.AnalyzerBeta;

public class Main {

	public static void main(String[] args) {
		
		// initialize output writer
		EntityWriter writer = new EntityWriter();
		
		// initialize analyzer
		// TODO: input.open(args[0]);
		//Analyzer analyzer = new Analyzer("test");
		AnalyzerBeta analyzer = new AnalyzerBeta("test");
		while(analyzer.hasNextPhrase()) {
			LinkedList<EntityElement> retrieved = analyzer.analyzeNextPhrase();
			// ----- JUST TESTING HERE --------
			for(EntityElement ele : retrieved) {
				System.out.println("FOUND "+ele.getType()+": "+ele.getElement()+" at index: "+ ele.getStartIndex());
			}
			// -------------------
			// add retrieved list to XML tree
			writer.addToTree(retrieved);
		}
		// commit final write
		writer.writeFinalFile();
	}
}
